package com.example.ibo.lollipopdemo.Adapters;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.ibo.lollipopdemo.Frag.MyFragment;
import com.example.ibo.lollipopdemo.R;

public class MyPagerAdapter extends FragmentPagerAdapter {

    String[] tabs;

    public MyPagerAdapter(FragmentManager fm, Activity activity) {
        super(fm);
        tabs = activity.getResources().getStringArray(R.array.tabs);
    }

    public MyPagerAdapter(FragmentManager fm, String[] tabs) {
        super(fm);
        this.tabs = tabs;
    }

    @Override
    public Fragment getItem(int position) {
        return MyFragment.getInstance(this,position);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tabs[position];
    }

    @Override
    public int getCount() {
        return tabs.length;
    }
}

